<div class="setting com_width">
    <?php include PROJECT_PATH . 'Application/View/menu.tpl.php';?>
    <div class="menu_head"></div>
    <div class="right">
        <?php foreach ($users as $user){?>
        <?php if(Model_User::getUserName() == $user['username'])continue;?>
        <div class="userlist">
            <div class="username">
            	<span class="username_title">用户名:</span>
            	<span class=""><?=$user['username']?></span>
            </div>
            <div class="auth">
            	<span>角色:</span>
            	<span><?=Model_User::getLevelName($user['levelid'])?></span>
            </div>
            <div class="operate">
                <div class="time">
                	<span>生成时间:</span>
                	<span><?=Model_Common::getFormatTime($user['createdtime'])?></span>
                </div>
                <div class="btn_wrapper">
                	<?php if(Model_User::getLevelID() == 5){?>
                    <span class="func btn btn_delete" onclick="del(<?=$user['userid']?>);">删除</span>
                    <span class="func btn" onclick="reset(<?=$user['userid']?>);" >重置密码</span>
                    <?php } ?>
                    </div>
            </div>
        </div>
        <?php }?>
        <div class="page">
      	  <?php if(empty($users)){?>
				<div style="margin-left:260px">暂无用户信息</div>
			<?php }else{?>     
          <span><a href="http://<?=HOST?>/user/list/page/<?=$pageNav['firstPage']?>">[首页]</a></span>
            <span><a href="http://<?=HOST?>/user/list/page/<?=$pageNav['prePage']?>">[上一页]</a></span>
            <?php foreach ($pageNav['pageList'] as $pageNum){
                  if($pageNum != $pageNav['nowPage']){ 
            ?>
            <span>
            <a href="http://<?=HOST?>/user/list/page/<?=$pageNum?>">[<?=$pageNum?>]</a>
            </span>
            <?php }else{ ?>
            <span><?=$pageNum?></span>
            <?php }}?>
            <span><a href="http://<?=HOST?>/user/list/page/<?=$pageNav['nextPage']?>">[下一页]</a></span>
            <span><a href="http://<?=HOST?>/user/list/page/<?=$pageNav['lastPage']?>">[尾页]</a></span>
            <?php }?>
        </div>
    </div>
</div>
<script type="text/javascript">
    function del(id)
    {
    	if(!confirm("确定删除吗？删除后不可恢复"))
    	{
        	return;
    	}
        $.ajax({
              url: "http://<?=HOST?>/user/doDel",
              cache: false,
              timeout:10000,
              type: "POST",
              data: {
                  userid:id
              },
              dataType: "json",
              beforeSend: function() {
                  disableHTML(true, '请稍等，处理中……', true);
              },
              success: function(data) {
                  if(data.errCode != 0){
                    disableHTML(true, data.errMsg, false);
                        setTimeout(disableHTML,2000);
                  }else{
                    disableHTML(true, '处理成功，跳转中……', true);
                    setTimeout("location.href = 'http://<?=HOST?>/user'",1000);
                  }
              },
              error:function(){
                  disableHTML(true, "请求出错，请重试或联系管理员", false);
                  setTimeout(disableHTML,2000);
              }
            });
    }
    function reset(id)
    {
        $.ajax({
              url: "http://<?=HOST?>/user/doReset",
              cache: false,
              timeout:10000,
              type: "POST",
              data: {
                  userid:id
              },
              dataType: "json",
              beforeSend: function() {
                  disableHTML(true, '请稍等，处理中……', true);
              },
              success: function(data) {
                  if(data.errCode != 0){
                    disableHTML(true, data.errMsg, false);
                        setTimeout(disableHTML,2000);
                  }else{
                    disableHTML(true, '处理成功，跳转中……', true);
                    setTimeout("location.href = 'http://<?=HOST?>/user'",1000);
                  }
              },
              error:function(){
                  disableHTML(true, "请求出错，请重试或联系管理员", false);
                  setTimeout(disableHTML,2000);
              }
            });
    }
</script>








